import request from '@/utils/request'

export function listCategorys(params) {
  return request.get('/book/bookCategory/listByWorkDirection', { params })
}

export function searchBooks(params) {
  return request.get('/search/searchByPage', { params })
}

//小说信息查询接口
export function getBookById(bookId) {
  console.log(bookId)
  return request.get(`/book/getBookById/${bookId}`)
}
//小说同类推荐列表查询接口
export function listRecBooks(params) {
  console.log(params)
  return request.get('/book/recList', { params })
}

//小说最新章节相关信息查询接口
export function getLastChapterAbout(params) {
  console.log(params)
  return request.get('/book/lastChapter/about', { params })
}
//小说最新评论查询接口
export function listNewestComments(params) {
  console.log(params)
  return request.get('/book/comment/newestList', { params })
}

export function comment(params) {
  return request.post('/book/bookComment/comment', params)
}

export function getBookContent(chapterId) {
  return request.get(`/book/bookContent/content/${chapterId}`)
}

export function getPreChapterId(chapterId) {
  return request.get(`/book/bookContent/preChapterId/${chapterId}`)
}

export function getNextChapterId(chapterId) {
  return request.get(`/book/bookContent/nextChapterId/${chapterId}`)
}

export function listChapters(params) {
  return request.get('/book/bookIndex/chapterList', { params })
}

export function addBookVisitCount(bookId) {
  return request.post(`/book/addVisitCount/${bookId}` );
}   
